package com.roomwrod.db;

import com.roomwrod.model.Word;

import java.util.List;

import androidx.lifecycle.LiveData;
import androidx.room.Dao;
import androidx.room.Delete;
import androidx.room.Insert;
import androidx.room.Query;
import androidx.room.Update;

@Dao
public interface WordDao {

    @Insert
    void insert(Word... words);

    @Query("delete from t_word where id=:id")
    void delete(int id);

    @Update
    void update(Word... words);

    @Query("select * from t_word ORDER BY id DESC")
    LiveData<List<Word>> getAllData();

    @Query("delete from t_word")
    void clear();

    @Query("select * from t_word where words LIKE :key ORDER BY id DESC")
    LiveData<List<Word>> findKeysData(String key);
}
